<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
		<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
		<script type="text/javascript">
			$(function(){
				var btn = $("#btn");
				btn.click(function(){
					$.ajax({
						//相当于action
						url:'/myjsp005/test',
						//相当于method
						type:'post',
						//相当于问号传参，也可以用问号传参
						data:'id=1',
						//服务器返回的数据类型,返回对象的时候一定要改
						dataType:'json',
						success:function(data){
							console.log(data);
							var id = $("#id");
							id.val(data.id);
							$("#name").val(data.name);
							$("#score").val(data.score);
						}
					});
				});
			})
		</script>
	</head>
	<body>
		编号：<input id="id" type="text" /><br />
		姓名：<input id="name" type="text"  /><br />
		成绩：<input id="score" type="text" /><br />
		
		<input id="btn" type="button" value="提交" />
	</body>
</html>